package UIFree.controls
{
	import UIFree.uif_component;
	import UIFree.uif_ecomponent;
	
	import flash.events.Event;
	import flash.geom.Rectangle;

	public class uif_checkbox extends uif_hotspotButton {
		public function uif_checkbox(parent:uif_component, ax:int=0, ay:int=0, awidth:int=0, aheight:int=0, styleClass:String='') {
			super(parent, ax, ay, awidth, aheight, styleClass);
		}

		override protected function doRelease(e: Event): void {
			checked = !checked;
		}
		
		override protected function updateTextFieldBounds(): void {
			super.updateTextFieldBounds();
			if (hotspot) {
				var w: int = hotspot.getOuter().width;
				textField.x += w;
				textField.width -= w;
			}
		}
		
		override protected function createHotspot(): uif_ecomponent {
			var inner: Rectangle = getInner();
			return new uif_ecomponent(this, inner.x, inner.y, inner.height, inner.height);
		}
	}
}